package com.mdtx.utils;

/**
 * 字符串功能工具类
 *
 * @author 猫啊
 * @create 2017-09-06 22:24
 **/
public class StringUtil {


    private static final String UNDERLINE="_";

    private static final String DOT="\\.";

    /**
     * 是否为空
     * @param str
     * @return
     */
    public static boolean isEmpty(String str){
        return (str == null || "".equals(str));
    }

    /**
     * 是否包含下划线
     * @param str
     * @return
     */
    public static boolean isContains(String str){
        return str.indexOf(UNDERLINE)<0?false:true;
    }


    /**
     * 按下划线切割
     * @param str
     * @return
     */
    public static String[] splitStr(String str){
        return  str.split(UNDERLINE);
    }

    public static String[] splitPackage(String str){
        return  str.split(DOT);
    }

    public static void main(String[] args) {
        System.out.println(isContains("sada_sd_a"));
    }


}
